Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@uppy/companion-client

Package Overview
Dependencies
Maintainers
5
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uppy/companion-client

Client library for communication with Companion. Intended for use in Uppy plugins.

  • 3.8.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
254K
increased by5.79%
Maintainers
5
Weekly downloads
 
Created

What is @uppy/companion-client?

@uppy/companion-client is a client-side library for Uppy, a modular file uploader for web browsers. It allows you to interact with Uppy Companion, a server-side component that handles file uploads from various sources such as local disk, remote URLs, and cloud services like Google Drive, Dropbox, and Instagram.

What are @uppy/companion-client's main functionalities?

Upload Files

This feature allows you to upload files to a specified endpoint using the Companion server. The code sample demonstrates how to upload a file named 'example.txt' to a Companion server.

const { uploadFile } = require('@uppy/companion-client');

const file = new File(['content'], 'example.txt', { type: 'text/plain' });

uploadFile(file, {
  endpoint: 'https://your-companion-server.com/upload',
  fieldName: 'file'
}).then(response => {
  console.log('File uploaded successfully:', response);
}).catch(error => {
  console.error('Error uploading file:', error);
});

Generate Pre-signed URLs

This feature allows you to generate pre-signed URLs for uploading files directly to cloud storage services like Amazon S3. The code sample demonstrates how to generate a pre-signed URL for a file named 'example.txt'.

const { getPreSignedUrl } = require('@uppy/companion-client');

getPreSignedUrl('https://your-companion-server.com/s3', {
  filename: 'example.txt',
  contentType: 'text/plain'
}).then(response => {
  console.log('Pre-signed URL:', response.url);
}).catch(error => {
  console.error('Error generating pre-signed URL:', error);
});

List Files

This feature allows you to list files from a specified source, such as Google Drive or Dropbox, using the Companion server. The code sample demonstrates how to list files from Google Drive.

const { list } = require('@uppy/companion-client');

list('https://your-companion-server.com/drive').then(response => {
  console.log('Files:', response.items);
}).catch(error => {
  console.error('Error listing files:', error);
});

Other packages similar to @uppy/companion-client

Keywords

FAQs

Package last updated on 02 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc